#[derive(Debug)]
struct User {
    id: u8,
    name: String,
    age: u8,
    height: f32,
}


fn main() {
    let mut user1 = User {
        id: 0,
        name: "小明".to_string(),
        age: 10,
        height: 1.2,
    };

    // 打印数据
    println!("user1={:?}", user1);
    // 换行打印
    println!("user1={:#?}", user1);

    // 修改数据
    user1.age = 12;
    println!("{}", user1.age);

    // 从其他结构体创建实例
    let mut user2 = User {
        name: "小白".to_string(),
        ..user1
    };
    println!("{}", user2.name);


    println!("=====元组结构体=====");
    {
        struct Point(i32, i32);

        let mut a = Point(10, 20);
        let mut b = Point(5, 10);

        println!("a.x={}, a.y={}", a.0, a.1);
    }

    println!("=====没有任何字段的结构体=====");
    {
        struct A {}
        ;
    }
}
